\documentclass[12pt,  letterpaper]{article}

\usepackage{xr, pstricks,fullpage, booktabs, graphicx,caption,subcaption,
	amsthm,amsmath,latexsym,amssymb,verbatim,url,setspace,multirow,fancyhdr,
	pdfsync,epstopdf,rotating,xfrac,footnote,titling, varwidth, pgfplots,framed}
\usepackage{bbding, pifont, xspace,enumitem}
\usepackage[hidelinks]{hyperref}
\hypersetup{
	colorlinks=true,       % false: boxed links; true: coloed links
	linkcolor=blue,          % color of internal links (change box color with linkbordercolor)
	citecolor=blue,        % color of links to bibliography
	filecolor=magenta,      % color of file links
	urlcolor=blue           % color of external links
}

\usepackage{forloop}
\newcounter{loopcntr}
\newcommand{\backwards}[1]{%
	\forloop{loopcntr}{0}{\value{loopcntr} < #1}{\!}
}

 
\usepackage{tablefootnote}
\usepackage[round,comma]{natbib}
\usepackage[bottom]{footmisc}
\usepackage{setspace}
\usepackage{footmisc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\bibliographystyle{apsr}
\bibliographystyle{ecta}
\citestyle{harvard}
 
\externaldocument{supplementary_materials_jesus_maria}

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,positioning, arrows.meta}
\newcommand{\ImageWidth}{11cm}
\usetikzlibrary{shapes,arrows, positioning}

\setcounter{MaxMatrixCols}{10}

\newcommand{\TEXTsymbol}[1]{#1}

\newtheorem{theorem}{Theorem}
\newtheorem{acknowledgement}[theorem]{Acknowledgement}
\newtheorem{algorithm}[theorem]{Algorithm}
\newtheorem{axiom}[theorem]{Axiom}
\newtheorem{case}[theorem]{Case}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{conclusion}[theorem]{Conclusion}
\newtheorem{condition}{Condition}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{corollary}{Corollary}
\newtheorem{criterion}[theorem]{Criterion}
\newtheorem{definition}{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{problem}[theorem]{Problem}
\newtheorem{proposition}{Proposition}

\newtheorem{solution}[theorem]{Solution}
\newtheorem{summary}[theorem]{Summary}
 \newtheorem{fact}{Fact}
\newtheorem{assumption}[theorem]{Assumption}

\newtheorem*{remark}{Remark}

\newcommand{\bunderline}[2][4]{\underline{#2\mkern-#1mu}\mkern#1mu}

\newcommand{\close}{ \epsilon\textsf{-close}}

\newcommand{\post}{\textsf{post}}
\newcommand{\ante}{\textsf{ante}}
\newcommand{\noi}{\noindent}
\newcommand{\sgn}{\textsf{sgn}\,}
\newcommand{\card}{\textrm{card}}
\newcommand{\supp}{\textsf{supp}\,}
\newcommand{\comp}{\textsf{comp}}
\newcommand{\coll}[1]{\ol{#1}}
\newcommand{\conv}{\textsf{Conv}}
\newcommand{\pie}{PIE\xspace}

\newcommand{\bmk}{\textsf{bmk}}

\newcommand{\mquad}{\!\!\!\!\!\!\!\!\!\!\!}

\newcommand{\mcm}{\mathcal M}

\newcommand{\mcl}[1]{\mathcal{#1}}
\newcommand{\ncomp}{{\lnot \textsf{comp}}}

\newcommand{\dotP}[1]{\left< #1\right>}

\newcommand{\1}{\mathbf{1}}

\newcommand{\esp}{\mathbb{E}}

\newcommand{\ti}[1]{\tilde #1}

\newcommand{\ul}[1]{\underline{#1}}

\newcommand{\ol}[1]{\overline{#1}}

\newcommand{\ora}[1]{\mathbf{#1}}

\newcommand{\der}[2]{\frac{\partial #1}{\partial #2}}

\newcommand{\derr}[3]{\frac{\partial^2 #1}{\partial #2 \partial #3}}

\newcommand{\wh}[1]{\widehat{#1}}

\newcommand{\intd}{\textrm d}

\newcommand{\note}[1]{ \smallskip \textcolor{blue}{[note -- #1]} \smallskip }

\newcommand{\prob}{\textsf{prob}}



\newenvironment{proofApp}[1]{\noi \textbf{Proof of #1. }}{$\quad
	\blacksquare$\\}



\newenvironment{proofComment}[1]{\noi \textbf{Proof (#1): }}{$\quad
	\blacksquare$\\}

\newenvironment{proofIntuition}{\noi \emph{Proof heuristic:
}}{$\quad \blacksquare$\\}


\newenvironment{rList}{\setcounter{Lcount}{0}
	\begin{list}{(\roman{Lcount}) } {\usecounter{Lcount}
			\setlength{\rightmargin}{\leftmargin}}}{\end{list}}

\newenvironment{tightList}{\setcounter{Lcount}{0}
	\begin{onehalfspacing}\begin{list}{(\roman{Lcount}) } {\usecounter{Lcount}
				\setlength{\rightmargin}{\leftmargin}}}{\end{list}\end{onehalfspacing}}


\newcommand{\rcand}{\and \hspace{-20pt} \textcircled{r} \hspace{-20pt} \and }
\newcounter{Lcount}

\graphicspath{{figs/}}


\linespread{1.2}
\title{Replication files for \\ \emph{Using Divide-and-Conquer to Improve Tax Collection} }

\author{By  Samuel Kapon \rcand Lucia Del Carpio \rcand Sylvain Chassang}
\date{}

\begin{document} 

\maketitle

\section{Setup}
The setup and replication is designed to run on a unix-based system.  To set up your environment:
\begin{enumerate} 
\item Ensure Python is installed on your machine. The code was tested using Python 3.8.10 and 3.10.12 under Ubuntu 22.04 LTR.
\item Add your folder that houses the replication files to your \texttt{PYTHONPATH} environment variable. For instance, if you place the replication folder \texttt{jm} in your own folder \texttt{/home/user}, then \texttt{/home/user} should be in your \texttt{PYTHONPATH} environment variable.
\item Install packages in the \texttt{requirements.txt} file. To do this using pip, run the following command in the terminal: \texttt{pip install -r requirements.txt}.
\end{enumerate}

\section{Replicating figures and tables (except for laboratory experiment)}
To replicate all figures and tables in the paper given the estimated parameters and simulations, change directory to the folder \texttt{jm} and run the following command in the terminal: \texttt{bash run$\_$all.sh}. 
This will replicate all files in the \texttt{figs} and \texttt{numbers} folders.


\vspace{1 em}

To replicate the files in \texttt{jm/estimates/parameter$\_$estimates/} open \texttt{jm/run$\_$all.sh}, set \texttt{run$\_$estimations} to \texttt{true},  and run \texttt{bash run$\_$all.sh} from the command line inside the \texttt{jm} folder.

\vspace{1 em}

To replicate the files in \texttt{jm/estimates/simulation$\_$estimates/}  given the estimated parameters, open \texttt{jm/run$\_$all.sh}, set \texttt{run$\_$simulations} to \texttt{true}, and run \texttt{bash run$\_$all.sh} from the command line inside the \texttt{jm} folder.


\vspace{1 em}

Re-generating all estimates and simulations takes a substantial amount of time and computing resources: roughly 8 days for   estimations, and 2 days for simulations, on a  cluster with $\sim$50-60 cpu cores (however only 4GB RAM is needed). We recommend first  testing the code to make sure it runs on your machine. To test, set all four variables at the top of \texttt{jm/run$\_$all.sh} to \texttt{true}, and run \texttt{bash run$\_$all.sh} from the command line inside the \texttt{jm} folder.

\section{Replication for laboratory experiment output}
To replicate output for the laboratory experiment in the online appendix, navigate into the folder \texttt{lab$\_$experiment} and \texttt{jm/run$\_$all.sh} and run the following command in the terminal: \texttt{python run$\_$for$\_$replication.py}. 

\end{document}
